package com.itheima.clientAndService01;

import java.util.LinkedList;

public class MainClass {
    public static void main(String[] args) {
        LinkedList<String> link = new LinkedList<>();
        link.add("aaa");
        link.add("bbb");
        link.add("ccc");
        link.add("ddd");

        method1(link);
        method2(link);
        method3(link);
        System.out.println(link);
    }

    private static void method3(LinkedList<String> link) {
        String first = link.getFirst();
        System.out.println(first);
        String last = link.getLast();
        System.out.println(last);
    }

    private static void method2(LinkedList<String> link) {
        String s = link.removeFirst();
        System.out.println(s);
        String s1 = link.removeLast();
        System.out.println(s1);
    }

    private static void method1(LinkedList<String> link) {
        link.addFirst("qqqq");
        System.out.println(link);
    }
}
